package org.dftproject.genesis.ui.actions;

import org.dftproject.genesis.ui.pages.PageManager;
import org.dftproject.genesis.ui.pages.home.HomePage;
import org.dftproject.genesis.ui.pages.home.HomePageInput;
import org.eclipse.jface.action.Action;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;

public class NewTabAction extends Action {
	
	public static final String ID = NewTabAction.class.getName();

	private final IWorkbenchWindow window;

	public NewTabAction(IWorkbenchWindow window) {
		this.window = window;
		setId(ID);
		setActionDefinitionId(ID);
		setText("New &Tab");
	}

	@Override
	public void run() {
		if (window != null) {
			IWorkbenchPage workbenchPage = window.getActivePage();
			PageManager.getDefault().openPage(workbenchPage, new HomePageInput(), HomePage.ID, true, true);
		}
	}

}
